import { createStore } from 'vuex';

export default createStore({
    state:{
        user_info:new Map([['获取中',{
            user_name: "获取中",
            company_name: "获取中",
            telephone: "获取中",
            password: "获取中",
            level: "获取中"
        }]]), // 初始状态为null，表示用户未登录,
       studentList:[
        {
            studentID: "11111111",
            name: "学生A"
        }
       ],
       teacherList:[
        {
            teacherID: "11111111",
            name: "教师A"
        }
       ],
       classList:[
        {
            courseID: "11111111",
            name: "课程A"
        }
       ],
    },
    //获取信息
    getters:{
        //输入姓名---返回用户配置信息
        getStudent(state, ){
            return state.user_info.get(userName)
        },
        //输入日期---返回环境数据
        getTeacher(state,date){
            return state.date_data.get(date)
        },
        getCpurse(state){
            return state.template_data
        }
    },
    //更新信息   添加/覆盖
    mutations:{
        //用户信息更新  重复---覆盖  新的---添加
        upDateUserInfo(state,userDataList){
            // state.user_info.set(userDataList.user_name,userDataList)
            state.user_info.set("user",userDataList)
        },
        //环境信息更新 
        upDateEnvData(state,date,dataList){
            state.date_data.set(date,dataList)
        },
        //临时数据更新
        upDateTemplate(state,template){
            state.template_data=template
        }
    }
});